export namespace="wasm-runtime"
export app_name="kwasm-operator"
export repo="kwasm"
export helm="$repo/$app_name"
export url="http://kwasm.sh/kwasm-operator/"
export kwasmimage="ghcr.io/kwasm/kwasm-operator"
export kwasmoperator="ghcr.io/spinframework/containerd-shim-spin/node-installer:v0.20.0"
# kwasm/kwasm-node-installer:main
# export kwasm_tag=$(curl -s https://api.github.com/repos/KWasm/kwasm-operator/tags | jq -r '.[0].name')

# echo "kwasm_tag: ${kwasm_tag}"

helm repo remove $repo
helm repo add $repo $url
helm repo update $repo

helm upgrade --create-namespace --install \
  -n $namespace $app_name $helm \
  --set kwasmOperator.installerImage=$kwasmoperator \
  --devel

# Annotate single node
# kubectl annotate node k3d-dev-agent-0 kwasm.sh/kwasm-node=true
# kubectl annotate node k3d-dev-agent-1 kwasm.sh/kwasm-node=true

kubectl annotate node --all kwasm.sh/kwasm-node=true

# kubectl apply -f https://ghproxy.net/https://raw.githubusercontent.com/KWasm/kwasm-node-installer/main/example/daemonset.yaml
